let i = 0
const requestFn = (url, methods='GET', params={}) => {
  i = i + 1
  wx.showLoading({
    title: '正在查询',
  })
  return new Promise((resolve, reject)=> {
    wx.request({
      url,
      methods,
      data: params,
      success: (res) => {
        resolve(res)
      },
      fail: (err) => {
        reject(err)
      },
      complete: (res) => {
        i = i - 1;
        if (i === 0) {
          wx.hideLoading();
        }
      }
    })
  })
}
module.exports = {
  requestFn: requestFn
}